﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using Chemistry.Models;
using GalaSoft.MvvmLight.Messaging;
using MahApps.Metro.Controls;

namespace Chemistry.Views
{
    /// <summary>
    /// GuideWindow.xaml 的交互逻辑
    /// </summary>
    public partial class GuideWindow : MetroWindow
    {
        public ExamineeLogin ExamineeLoginWindow { get; set; }

        public GuideWindow()
        {
            InitializeComponent();

            this.Unloaded += ExamWindow_Unloaded;
            this.Closing += GuideWindow_Closing;


            Messenger.Default.Register<bool>(this, MessageToken.ShowEquipmentWindow, (i) =>
            {
                ExamWindow win = new ExamWindow(i);
                win.GuideWindow = this;
                win.Show();
                this.Hide();
            });
        }

        void GuideWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            
            
            ExamineeLoginWindow.Show();
            Messenger.Default.Send<object>(null,MessageToken.BackLogin);
        }

        private void ExamWindow_Unloaded(object sender, RoutedEventArgs e)
        {
            Messenger.Default.Unregister(this);
        }
          
    }
}
